using System;
using UnityEngine;

namespace DanielSig.UnityExtensions
{
	public static class XQuaternion
	{
		public static Quaternion Minus(this Quaternion v, Quaternion other)
		{
			return Quaternion.Inverse(other) * v;
		}
		public static Quaternion Multiply(this Quaternion v, float amount)
		{
			return Quaternion.Slerp(Quaternion.identity, v, amount);
		}
		public static Quaternion Inversed(this Quaternion v)
		{
			return Quaternion.Inverse(v);
		}
		public static Quaternion Randomize(this Quaternion v, float amount)
		{
			return Quaternion.Slerp(v, UnityEngine.Random.onUnitSphere.Rotation(), amount);
		}
		public static Quaternion LerpTo(this Quaternion v, Quaternion other, float amount)
		{
			return Quaternion.Lerp(v, other, amount);
		}
		public static Quaternion SLerpTo(this Quaternion v, Quaternion other, float amount)
		{
			return Quaternion.Slerp(v, other, amount);
		}
		public static bool Aproximates(this Quaternion v, Quaternion other, float threshold)
		{
			return (v * Vector3.forward).Aproximates(other * Vector3.forward, threshold);
		}
	}
}